package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum TransactionAnalysisStatus {
	
	ORDERSCOUNT(0,"下单数"),
	PAYMONEY(1,"付款金额"),
	ORDERSUSERCOUNT(2,"下单人数"),
	ORDERSGOODSCOUNT(3,"下单件数"),
	ORDERSMONEY(4,"下单金额"),
	PAYUSERCOUNT(5,"付款人数"),
	PAYORDERSCOUNT(6,"付款笔数"),
	PAYNUMBER(7,"付款件数");
	
	private Integer value;
	private String text;

	private TransactionAnalysisStatus(Integer value,String text) {
		this.value = value;
		this.text = text;
	}

	public Integer toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static TransactionAnalysisStatus toStatus(Integer value) {
		if (ORDERSCOUNT.value == value) {
			return ORDERSCOUNT;
		} else if (PAYMONEY.value == value) {
			return PAYMONEY;
		} else if (ORDERSUSERCOUNT.value == value) {
			return ORDERSUSERCOUNT;
		} else if (ORDERSGOODSCOUNT.value == value) {
			return ORDERSGOODSCOUNT;
		} else if (ORDERSMONEY.value == value) {
			return ORDERSMONEY;
		} else if (PAYUSERCOUNT.value == value) {
			return PAYUSERCOUNT;
		} else if (PAYORDERSCOUNT.value == value) {
			return PAYORDERSCOUNT;
		} else if (PAYNUMBER.value == value) {
			return PAYNUMBER;
		}else {
			throw new InvalidArgumentException("Unknown OrderStatus[" + value + "].");
		}
	}
}
